package com.mew.chess.core.common.message.request;

import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@ToString(callSuper = true)
@NoArgsConstructor
public class GiftRequestMessage extends ZebraBaseMessage<GiftRequestMessage> {

    private long userId; //送礼玩家
    private long toUserId; //收礼玩家
    private int giftType; //礼物类型
    private int giftIdx; //礼物下标
    @Override
    public void write(ByteBuf b) {
        writeLong(b,userId);
        writeLong(b, this.toUserId);
        writeInt(b, this.giftType);
        writeInt(b, this.giftIdx);
    }

    @Override
    public GiftRequestMessage read(ByteBuf b) {
        GiftRequestMessage betRequestMessage = new GiftRequestMessage();
        betRequestMessage.toUserId = readLong(b);
        betRequestMessage.giftType = readInt(b);
        betRequestMessage.giftIdx = readInt(b);
        return betRequestMessage;
    }
}
